Socket
Socket
Sign inDemoInstall

outdent

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

outdent

Remove leading indentation from ES6 template literals.


Version published
Weekly downloads
1.7M
increased by11.24%
Maintainers
1
Weekly downloads
 
Created

What is outdent?

The 'outdent' npm package is a utility for removing leading indentation from multiline strings. It helps in maintaining clean and readable code by allowing developers to write multiline strings without worrying about the indentation affecting the string content.

What are outdent's main functionalities?

Basic Usage

This feature allows you to remove leading indentation from a multiline string. The `outdent` function is used as a tagged template literal to process the string and remove any leading spaces.

const outdent = require('outdent');
const text = outdent`
  This is a multiline string.
  The indentation will be removed.
`;
console.log(text);

Custom Indentation

This feature allows you to customize the behavior of the outdent function. In this example, the `trimLeadingNewline` option is set to `false`, so the leading newline is preserved.

const outdent = require('outdent');
const text = outdent({ trimLeadingNewline: false })`
  This is a multiline string.
  The first line's indentation will be preserved.
`;
console.log(text);

Nested Templates

This feature demonstrates how you can use nested templates with the outdent function. The nested template's indentation is also removed, ensuring consistent formatting.

const outdent = require('outdent');
const nested = outdent`
  Nested template
  with indentation.
`;
const text = outdent`
  This is a multiline string.
  ${nested}
  The indentation will be removed.
`;
console.log(text);

Other packages similar to outdent

Keywords

FAQs

Package last updated on 16 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc